﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using BattleshipContract;
using System.ServiceModel.Channels;

namespace service
{
    class Program
    {
        static void Main(string[] args)
        {
            /* ServiceHost host = new ServiceHost(typeof(CGame));
             Type contract = typeof();
             WSHttpBinding binding = new WSHttpBinding();
             Uri address = new Uri("http://localhost:8000/calculatorservice");
             host.AddServiceEndpoint(contract, binding, address);
             */

            ServiceHost host = new ServiceHost(typeof(CGame));
            Type contract = typeof(IGamePlay);
            WSHttpBinding binding = new WSHttpBinding();
            Uri address = new Uri("http://localhost:8000/service");
            host.AddServiceEndpoint(contract, binding, address);
            host.Open();
            Console.WriteLine("The service is being hosted at address " + address);
            Console.WriteLine("Press <Enter> to stop hosting.\n");
            Console.ReadLine();
            host.Close();
            Binding wsBinding = new WSHttpBinding();
            Binding tcpBinding = new NetTcpBinding();
            host.AddServiceEndpoint(typeof(IGamePlay), wsBinding,
            "http://localhost:8000/MyService");
            host.AddServiceEndpoint(typeof(IGamePlay), tcpBinding,
            "net.tcp://localhost:8001/MyService");
            host.AddServiceEndpoint(typeof(IGamePlay), tcpBinding,
            "net.tcp://localhost:8002/MyService");
            host.Open();
        }
    }
}
